using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication4
{
    public partial class VillageDisplay : UserControl
    {
        public VillageDisplay()
        {
            InitializeComponent();
        }
        
        Village village = null;
        public Village VillageToDisplay
        {
            get
            {
                return village;
            }
            set
            {
                if (village == null || !village.Equals(value))
                {
                    village = value;
                    DisplayVillage();
                }
            }
        }
        private void VillageDisplay_Load(object sender, EventArgs e)
        {
            DisplayVillage();
        }

        private void DisplayVillage()
        {
            lblVillage.Text = "";
            lblPoints.Text = "";
            lblOwner.Text = "";
            lblTribe.Text = "";

            if (village != null)
            {
                Player player = village.VillageOwner;
                lblVillage.Text = village.name + " - (" + village.X.ToString() + "|" + village.y.ToString() + ")";
                lblPoints.Text = village.Points.ToString();
                if (player != null)
                {
                    lblOwner.Text = village.VillageOwner.Name + " (" + village.VillageOwner.Points.ToString("#,###") + ")";

                    Tribe t = player.Tribe;
                    if (t != null)
                    {
                        lblTribe.Text = t.Tag + " (" + t.Name + ")";
                    }
                }
            }
        }


 
    }
}
